<?php

namespace app\admin\controller;

use app\common\lib\Util;

class Image
{
    public function index()
    {
        $file = request()->file('file');
        $info = $file->move('../public/static/upload');
        //http://192.168.0.105:8501/upload/20180731/13f88e8041d3be6d8620bd750cc647e4.png
        if ($info) {
            $data = [
                'image' => config('live.host').'/upload/'.$info->getSaveName(),
            ];
            return Util::show(config('code.success'),'ok',$data);
        } else {
            return Util::show(config('code.error'),'error');
        }
    }


}
